<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

<head>
<title>学生信息完善</title>
<meta name="keywords" content="[keywords]" />

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="本系统基于TP3.2开发，感谢开源">
<link rel="shortcut icon" href="favicon.ico">
<link href="/orientation/Public/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
<link href="/orientation/Public/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
<link href="/orientation/Public/css/animate.min.css" rel="stylesheet">
<link href="/orientation/Public/css/style.min862f.css?v=4.1.0" rel="stylesheet">
<link href="/orientation/Public/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/orientation/Public/css/iconfont.css" rel="stylesheet"/>

    <!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
</head>


<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div method="get" class="form-horizontal">
            	
		<!--信息完善开始-->
	    	<?php if($res["forecast"] == 0): ?><script type="text/javascript">
					alert("请先预报到！");
					location.href="<?php echo U('forecast');?>";
				</script>
	    		
	    	<?php else: ?>
	    	
	    		<div class="form-group">
		            <label class="col-sm-2 control-label">身份证</label>
		            <div class="col-sm-10">
		                <input type="text" class="form-control" value="<?php echo ($res["idcard"]); ?>" id="idcard">
		            </div>
			    </div>
		        <div class="hr-line-dashed"></div>
	    	
				<div class="form-group">
		            <label class="col-sm-2 control-label">学号</label>
		            <div class="col-sm-10">
		                <input type="text" class="form-control" value="<?php echo ($res["studentid"]); ?>" id="studentid">
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">学生姓名</label>
		            <div class="col-sm-10">
		                <input type="text" class="form-control" value="<?php echo ($res["studentname"]); ?>" id="studentname">
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
                
                <div class="form-group">
		            <label class="col-sm-2 control-label">性别</label>
		            <div class="col-sm-10">
		            	<?php if($res["studentsex"] == 男): ?><input type="radio" name="studentsex" id="studentsex" value="男" checked="checked" />男
		            		<input type="radio" name="studentsex" id="studentsex" value="女" />女
		            	<?php else: ?>
		            		<input type="radio" name="studentsex" id="studentsex" value="男" />男
		            		<input type="radio" name="studentsex" id="studentsex" value="女" checked="checked" />女<?php endif; ?>
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">学生电话</label>
		            <div class="col-sm-10">
		                <input type="text" value="<?php echo ($res["studentnumber"]); ?>" id="studentnumber" maxlength="11" onkeyup="value=value.replace(/[^\d]/g,'')" ng-pattern="/[^a-zA-Z]/" />
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">家庭地址</label>
		            <div class="col-sm-10">
		                <input type="text" id="address" value="<?php echo ($res["address"]); ?>" />
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">是否有病史</label>
		            <div class="col-sm-10">
		            	<?php if($res["sick"] == 1): ?><input type="radio" name="sick" id="sick" value="1" checked="checked" />是
	            			<input type="radio" name="sick" id="sick" value="0" />否
	            		<?php else: ?>
	            			<input type="radio" name="sick" id="sick" value="1" />是
	            			<input type="radio" name="sick" id="sick" value="0" checked="checked" />否<?php endif; ?>
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">贫困证明</label>
		            <div class="col-sm-10">
		                <input type="text" id="prove" value="<?php echo ($res["prove"]); ?>" />
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">是否购买保险</label>
		            <div class="col-sm-10">
		            	<?php if($res["insurance"] == 1): ?><input type="radio" name="insurance" id="insurance" value="1" checked="checked" />是
	            			<input type="radio" name="insurance" id="insurance" value="0" />否
	            		<?php else: ?>
	            			<input type="radio" name="insurance" id="insurance" value="1" />是
	            			<input type="radio" name="insurance" id="insurance" value="0" checked="checked" />否<?php endif; ?>
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div>
		        
		        <div class="form-group">
		            <label class="col-sm-2 control-label">提交</label>
		            <div class="col-sm-10">
			            <button id="submit" data-id="<?php echo ($res["idcard"]); ?>"  class="btn btn-sm btn-info report" title="信息完善" onclick="return confirm('请核对自己的信息！确认修改吗？')">完成</button>
		            </div>
		        </div>
		        <div class="hr-line-dashed"></div><?php endif; ?>

		<!--信息完善结束-->
		
					</div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>


<script src="/orientation/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/orientation/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/orientation/Public/js/plugins/jeditable/jquery.jeditable.js"></script>
<script src="/orientation/Public/js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="/orientation/Public/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="/orientation/Public/js/content.min.js?v=1.0.0"></script>
<!--<script>-->
    <!--$(document).ready(function(){$(".dataTables-example").dataTable();var oTable=$("#editable").dataTable();oTable.$("td").editable("http://www.zi-han.net/theme/example_ajax.php",{"callback":function(sValue,y){var aPos=oTable.fnGetPosition(this);oTable.fnUpdate(sValue,aPos[0],aPos[1])},"submitdata":function(value,settings){return{"row_id":this.parentNode.getAttribute("id"),"column":oTable.fnGetPosition(this)[2]}},"width":"90%","height":"100%"})});function fnClickAddRow(){$("#editable").dataTable().fnAddData(["Custom row","New row","New row","New row","New row"])};-->
<!--</script>-->
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script>
	$('#submit').on('click',function () {
        var btn = $(this);
        var idcard = btn.data('id');
        var studentsex = $('input[name=studentsex]:checked').val();
        var studentnumber = $('#studentnumber').val();
        var address = $('#address').val();
        var sick = $('input[name=sick]:checked').val();
        var prove = $('#prove').val();
        var insurance = $('input[name=insurance]:checked').val();
        var param = {
            idcard:idcard,
            studentsex:studentsex,
            studentnumber:studentnumber,
            address:address,
            sick:sick,
            prove:prove,
            insurance:insurance,    
        };
        console.log(idcard)
        var url = "<?php echo U('Student/report');?>";
        $.ajax({
            url: url,
            data: param,
            dataType: 'json',
            type: 'post',
            success: function (data) {
                var dotr = btn.closest('tr');
                alert(data.info);
                if (data.status == 1) {
                	window.location.href="<?php echo U('Student/home');?>";
                    dotr.remove();
                }
            },
            error: function () {
                alert('操作失败');
            }
        })
    })
</script>
</html>